#set(title="发布帖子")
#@WeuiLayout()
#define content()
<div id="addContent">
	<form>
		<input type="hidden" name="subject_id" value="#(subject_id)"/>
		#if(catalogList&&catalogList.size()>0)
		<div class="weui-cells__title">分类：</div>
		<div class="weui-cells weui-cells_form">
			<div class="weui-cell">
	    	<div class="weui-cell__bd">
	      	<select class="weui-select" name="catalog_id">
            #for(item:catalogList)
            <option value="#(item.id)">#(item.name)</option>
            #end
          </select>
	    	</div>
	  	</div>
		</div>
		#end
		<div class="weui-cells__title">标题：</div>
		<div class="weui-cells weui-cells_form">
			<div class="weui-cell">
	    	<div class="weui-cell__bd">
	      		<input class="weui-input" type="text" placeholder="请大致描述内容" name="name"/>
	    	</div>
	  	</div>
		</div>
		<div class="weui-cells__title">内容：</div>
		<div class="weui-cells weui-cells_form">
      <div class="weui-cell">
        <div class="weui-cell__bd">
          <textarea class="weui-textarea" name="content" placeholder="请输入发布内容" rows="8"></textarea>
          <div class="weui-textarea-counter">最多400字</div>
        </div>
      </div>
    </div>
    #if(param("TIEBA_CONTENT_IMAGES")=="T")
    #end
	</form>
</div>
<div class="weui-btn-area">
	<a href="javascript:;" class="weui-btn weui-btn_primary" onclick="submitContent()">发布</a>
</div>
<div style="height: 30px"></div>
#end
#define jsFunction()
<script>
	function submitContent(){
		$.ajax({
			url:"#(path)/mobile/tieba/doAddContent",
			type:"POST",
			async:false,
			data:$("#addContent form").serialize(),
			dataType:"json",
			success:function(data){
				if(data.result=="success"){
					location.href="#(path)/mobile/tieba/list?id=#(subject_id)";
				}else {
					$.toast(data.message,"forbidden");
				}
			}
		})
	}
</script>
#end